package ljx;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class insert {
    public static void main(String[] args) {
        Connection conn=null;
        PreparedStatement st=null;
        ResultSet rs=null;

        try {
            conn= JdbcUtils.getConnection();
            String sql="insert into users(id,name,password,email)values(?,?,?,?)";
            st=conn.prepareStatement(sql);
            st.setInt(1,12);
            st.setString(2,"ljx");
            st.setString(3,"666");
            st.setString(4,"456789");
            int num=st.executeUpdate();
            if(num>0){
                System.out.println("注册成功");
            }

        } catch (SQLException e) {
            e.printStackTrace();
        }
        finally {
            JdbcUtils.relesse(conn,st,rs);
        }
    }
}
